package com.docker.manege.image;

import com.docker.core.mvc.dao.BaseDao;
import com.jfinal.kit.Okv;
import com.jfinal.plugin.activerecord.Record;

/**
 * @Author ldl
 * @Create 2021/01/13 013 10:48
 */
public class ImagesDao extends BaseDao {

    @Override
    protected String getSqlTplNameSpace() {
        return "docker.image";
    }

    public boolean save(Record image) {
        return save("docker_image_info", "ri_id", image);
    }

    public Record info(Okv cond) {
        return tplSPInfo("info.cond", cond);
    }

    public boolean update(Record image) {
        return update("docker_image_info", "ri_id", image);
    }

    public Record detail(Okv cond) {
        return tplSPInfo("detail", cond);
    }

    public boolean exist(String serverId, String imageName, String riId) {
        return tplQueryInt("exist", serverId, imageName, riId) > 0;
    }

}
